using System;
using CGF;
using UnityEngine;

public class BtnVideo : MonoBehaviour
{
    private static bool HasAutoShowVideo
    {
        get { return PlayerPrefs.GetInt("HasAutoShowVideo", 0) == 1; }
        set { PlayerPrefs.SetInt("HasAutoShowVideo", value ? 1 : 0); }
    }

    private void Awake()
    {
        if (Define.IsWebGL && !Application.isEditor)
        {
            gameObject.SetActive(false);
            return;
        }
        GetComponent<CButton>().SetClick(() =>
        {
            PanelSampleVideo.Open();
        });
    }

    private void Start()
    {
        if (!Define.IsWebGL)
        {
            if (!HasAutoShowVideo)
            {
                HasAutoShowVideo = true;
                PanelSampleVideo.Open();
            }
        }
    }
}
